const NODE_ENV = 'dev'

function returnHost(sign) {
  let host, hostSeller
  if (NODE_ENV === 'production') {
    host = 'http://10.11.29.201:8080/'
  } else if (NODE_ENV === 'test') {
    host = 'http://10.11.29.201:8080/'
  }else {
    host = 'http://10.11.29.201:8080/'
    //host = 'https://holo-aimall.mmall.com/'
  }
  if (sign == 'host') {
    return host
  } else if (sign == 'hostSeller') {
    return hostSeller
  }
}

export const HOST = returnHost('host')

export const HOSTSELLER = returnHost('hostSeller')

export function changeParam(obj) {
  let str = []

  for (let p in obj) {
    if (obj.hasOwnProperty(p)) {
      str.push(`${p}=${obj[p]}`)
    }
  }

  return `?${str.join('&')}`
}